{include file="public/head" /}
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>商家店铺入住管理</cite></a>
        <a><cite>商家优惠券列表</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <xblock>
        <button class="layui-btn " onclick="x_admin_show('添加商品','{:url('admin/shop/goodAdd')}',800,700)"><i class="layui-icon"></i>添加商品</button>
        <button class="layui-btn layui-btn-danger" onclick="x_admin_show('添加促销商品','{:url('admin/shop/goodAddPro')}',800,700)"><i class="layui-icon"></i>添加促销商品</button>
        <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table" id="table">
        <thead  style="text-align:center;">
          <tr>
            <th style="text-align: center; font-size: 16px;">所属店铺</th>
            <th style="text-align: center; font-size: 16px;">商品名称</th>
            <th style="text-align: center; font-size: 16px;">是否促销</th>
            
            <th style="text-align: center; font-size: 16px;">商品价格</th>
            <th style="text-align: center; font-size: 16px;">促销价</th>
            <th style="text-align: center; font-size: 16px;">图片</th>  
            <th style="text-align: center; font-size: 16px;">商品类别</th>
            <th style="text-align: center; font-size: 16px;">商品状态</th>
            <th style="text-align: center; font-size: 16px;">操作</th>
          </tr>
        </thead>
        <tbody style="text-align:center;">
            {foreach $list as $lis}
            <tr>
              <td style="text-align: center;height:60px">{$lis.shop_name}</td>
              <td style="text-align: center;">{$lis.goods_name}</td>
              <td style="text-align: center;">
              {if $lis.promotion_type=="0"}
                无促销
              {/if}
              {if $lis.promotion_type=="1"}
                促销
              {/if}</td>
              <td style="text-align: center;">{$lis.price}</td>
              
              <td style="text-align: center;">{$lis.salesprice}</td>
              <td style="text-align: center;"><img src="/shop/upload/{$lis.picture}" style="width:50px;height:50px"/></td>
              <td style="text-align: center;">{$lis.category_name}</td>
              <td style="text-align: center;">
                  {if $lis.state=="0"}
                    待审核
                  {/if}
                  {if $lis.state=="1"}
                   上架
                  {/if}
                  {if $lis.state=="2"}
                   审核失败
                  {/if}
                   {if $lis.state=="3"}
                   下架
                  {/if}
              </td>
             
              <td style="text-align: center;">
                {if $lis.state=="0"}
                  <a title="上架"  onclick="goodUp('{$lis.goods_id}')" href="javascript:;">
                    <i class="layui-icon">&#xe605;</i>
                  </a>
                  <a title="下架""  onclick="goodCheckFail('{$lis.goods_id}')" href="javascript:;">
                    <i class="layui-icon">&#x1006;</i>
                  </a>
                  
                  
                {/if}
                <a title="商品编辑"  onclick="x_admin_show('商品编辑','{:url('admin/shop/goodedit')}?goods_id={$lis.goods_id}',600,500)" href="javascript:;">
                    <i class="layui-icon">&#xe614;</i>
                  </a>
                  <a title="删除" onclick="goodDel('{$lis.goods_id}')" href="javascript:;" id="goods{$lis.goods_id}">
                    <i class="layui-icon">&#xe640;</i>
                  </a>
              </td>
            </tr>
            {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div id="page">
            {$list->render()}
        </div>
      </div>

    </div>
    <script>

      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });
        //删除
      function goodUp(goods_id){
        //alert(goods_id);return false;
        var url="{:url('goodUp')}?goods_id="+goods_id;
         window.location.href=url;
         
          return false; 
      } 
      function goodCheckFail(goods_id){
        
         window.location.href="{:url('goodCheckFail')}?goods_id="+goods_id;
         
          return false; 
      } 
      function goodDel(goods_id){
        if(confirm('删除后无法恢复，确定要删除吗?')) 
        { 
          var url = "{:url('goodDel')}?goods_id=" + goods_id
          // console.log(url)
          $('#goods' + goods_id).attr('href', url)
        } 
          return false; 
      } 
    </script>

    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>

  </body>

</html>